import { ElMessage  } from 'element-plus'

let messageInstance:any | null =null

const resetMessage = (e:any) => {
    if (messageInstance  && messageInstance.close) {
        return
    }
    messageInstance = ElMessage(
        {
            type:e.type?e.type:'success',
            duration:e.duration?e.duration:3000,
            message:e.message,
            onClose:()=>{
                messageInstance=null
            }
        }
    )
}


export const Message = resetMessage 
